//
//  HZYBaseNetWork.m
//  LaomiKit
//
//  Created by laomi on 2020/9/18.
//  Copyright © 2020 laomi. All rights reserved.
//

#import "HZYBaseNetWork.h"
NSString *const cp_base_url = @"https://gateway.lamp.sixiaoai.com";
//NSString *const cp_base_url = @"http://192.168.88.40:8000";
static NSString *preferenceBaseURL = nil;

@implementation HZYBaseNetWork

//设置自己的baseURL;
+(void)settingPreferenceBaseURL:(NSString*)baseURL;//设置baseURL;如果不设置；则默认会定义一个baseURL;
{
    preferenceBaseURL = baseURL;
}
//获取设置过的baseURL;如果没有设置过；则返回nil
+(NSString*)gettingPreferenceBaseURL;
{
    return preferenceBaseURL;
}

//设置preferenceBaseURL后；就可以用这个凭借url;
+(NSString*)preferenceBaseUrlFactory:(NSString*)api;
{
    NSString *fullURL = [[self gettingPreferenceBaseURL] stringByAppendingString:api];
    return fullURL;
}


//api+base工具；如果不愿意设置；或者以上设置的不满足；可以自己拼接
+(NSString*)urlFactory:(NSString*)baseurl suburl:(NSString*)api;
{
    NSString *fullURL = [baseurl stringByAppendingString:api];
    return fullURL;
}

//默认的；不会去读取自己设置过的
+(NSString*)defaultBaseUrlFactory:(NSString*)api;
{
    NSString *fullURL = [cp_base_url stringByAppendingString:api];
    return fullURL;
}
@end
